package com.heima.wemedia.controller.v1;


import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmSensitiveDto;
import com.heima.model.wemedia.pojos.WmSensitive;
import com.heima.wemedia.service.WmSensitiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
public class WmSensitiveController {
    @Autowired
    private WmSensitiveService wmSensitiveService;
    //添加敏感词
    @PostMapping("/save")
    public ResponseResult addSensitive(@RequestBody WmSensitive wmSensitive) {
        return wmSensitiveService.addSensitive(wmSensitive);
    }
    //删除敏感词/del/{id}`
    @DeleteMapping("/del/{id}")
    public ResponseResult deleteSensitive(@PathVariable("id") Integer id) {
        return wmSensitiveService.deleteSensitive(id);
    }
    //修改敏感词
    @PostMapping("/update")
    public ResponseResult updateSensitive(@RequestBody WmSensitive wmSensitive) {
        return wmSensitiveService.updateSensitive(wmSensitive);
    }
    //分页查询敏感词
    @PostMapping("/list")
    public ResponseResult findSensitive(@RequestBody WmSensitiveDto dto) {
        return wmSensitiveService.findSensitive(dto);
    }



}
